<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="content-language" content="zh-CN" />
<meta name="author" content="Hishop development team" />
<meta name="GENERATOR" content="5.8(KB58001)" />
<title>用户登录 - 茅台商城</title>
</head>
<body>
<form name="aspnetForm" method="post" action="./login.aspx" id="aspnetForm">
<div>
<input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTE3MzA1ODMyMTVkGAEFHl9fQ29udHJvbHNSZXF1aXJlUG9zdEJhY2tLZXlfXxYBBQ5sb2dpbiRjaGtBZ3JlZQY0ByXLBf7CFSvt2cECf0c6NJNs" />
</div>
<div>

	<input type="hidden" name="__VIEWSTATEGENERATOR" id="__VIEWSTATEGENERATOR" value="C2EE9ABB" />
	<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
	<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
</div>
    <!-- 此段必须要引入 t为小时级别的时间戳 -->
    <script type="text/javascript" src="js/jquery-3.2.1.min.js"></script>
    <script type="text/javascript" src="js/nc.js"></script>

    <!-- 引入结束 -->
    <div class="main" id="main1">
        
        <div class="logindiv">
            <div class="loginimg"><div class="adv_image cssEdite" type="image" id="ads_500" >
			</div>
            <div class="logingbj" style="height:501px;">
                <div class="logingfome" style="height:470px;">
                    <h1 class="YaHei">用户登录</h1>
                    <table border="0" cellspacing="0" cellpadding="0">
                        <tr>
                            <td width="60" height="55" valign="bottom">用户名：</td>
                            <td colspan="2" valign="bottom">
                                <input name="login$txtUserName" type="text" id="login_txtUserName" class="inputbj" style="width:240px;" />
                            </td>
                        </tr>
                        <tr>
                            <td height="70">密&nbsp;&nbsp;&nbsp;&nbsp;码：</td>
                            <td colspan="2"><input name="login$txtPassword" type="password" id="login_txtPassword" class="inputbj" Button="btnLogin" style="width:240px;" /></td>
                        </tr>
                       
                        <tr>
                            <td>验证码:</td>
                            <td colspan="2">
                                <div class="ln">
                                    <div id="dom_id"></div>
                                </div>

                                <input name="login$csessionid" type="text" id="login_csessionid" hidden="hidden" name="csessionid" />
                                <input name="login$sig" type="text" id="login_sig" hidden="hidden" name="sig" />
                                <input name="login$token" type="text" id="login_token" hidden="hidden" name="token" />
                                <input name="login$scene" type="text" id="login_scene" hidden="hidden" name="scene" />

                            </td>
                        </tr>

                    </table>
                    
                </div>
            </div>
        </div>
    </div>
</form>
<script language="javascript" type="text/javascript">

    var nc = new noCaptcha();
    var nc_appkey = 'FFFF00000000016A8646';  // 应用标识,不可更改
    var nc_scene = 'login';  //场景,不可更改
    var nc_token = [nc_appkey, (new Date()).getTime(), Math.random()].join(':');
    var nc_option = {
        renderTo: '#dom_id',//渲染到该DOM ID指定的Div位置
        appkey: nc_appkey,
        scene: nc_scene,
        token: nc_token,
        //trans: '{"name1":"code100"}',//测试用，特殊nc_appkey时才生效，正式上线时请务必要删除；code0:通过;code100:点击验证码;code200:图形验证码;code300:恶意请求拦截处理
        callback: function (data) {// 校验成功回调
            console.log(data);
            console.log(data.csessionid);
            console.log(data.sig);
            console.log(nc_token);
            $.ajax({  
                type: 'POST',  
                url: 'insertSessionLogin.do' ,           
                dataType: 'text',  
                contentType:'application/text;charset=UTF-8',  
                data:data,
                success:function(data){  
                	console.log(data); 
                },  
                error:function(textStatus, errorThrown){  
                    console.log(textStatus);  
                }  
            });  
            //document.getElementById('login_csessionid').value = data.csessionid;
            //document.getElementById('login_sig').value = data.sig;
            //document.getElementById('login_token').value = nc_token;
            //document.getElementById('login_scene').value = nc_scene;
            window.location.reload();
        }
    };
    nc.init(nc_option);
    $(function(){
    	t = setInterval("showAuto()", 3000);
	})
	var imgsrc = "";
    function showAuto(){
    	var src = $("#nc_1__imgCaptcha_img").children("img").attr("src");
    	console.log(src); 
    	console.log(imgsrc); 
    	console.log(src==imgsrc); 
    	if(src!=undefined&&src!=imgsrc){
    		imgsrc = src;
    		//将src的值发到后台打码，返回
        	$.ajax({  
                type: 'POST',  
                url: 'decodeImage.do' ,           
                dataType: 'text',  
                contentType:'application/text;charset=UTF-8',  
                data:src,
                success:function(data){  
                	console.log(data); 
                	document.getElementById("nc_1_captcha_input").value=data;
                	document.getElementById("nc_1_scale_submit").click();
                },  
                error:function(textStatus, errorThrown){  
                    console.log(textStatus);  
                }  
            }); 
    	}
    }
</script>
</body>






